<template>
	<view>
		<view class="editTelsetting">
			<view class="editTel-item">
				<label class="editTel-item-label">原号码</label>
				<label class="editTel-item-text">{{tel}}</label>
			</view>
			<view class="editTel-item">
				<label class="editTel-item-label">新号码</label>
				<uni-easyinput class="user-item-input" type="text" v-model="newTel" placeholder="请输入新的手机号码"
					:inputBorder="false" :placeholderStyle="placeholderStyle" maxlength="11" />
			</view>
			<view class="editTel-item">
				<label class="editTel-item-label">验证码</label>
				<uni-easyinput class="user-item-input" type="text" v-model="code" placeholder="请输入验证码"
					:inputBorder="false" :placeholderStyle="placeholderStyle" maxlength="6" />
				<label class="code-btn" @click="onGetCode">{{codeBtnText}}</label>
			</view>
		</view>
		<button type="default" :disabled="disabled" class="submit-btn" @click="onSubmitClick">提交</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				disabled:false,
				placeholderStyle: "font-size:30rpx;color:#acacac;",
				tel: "186****1688",
				newTel: "",
				code: "",
				codeBtnText: "获取验证码",
				timeOut: 60,
			}
		},
		methods: {
			onGetCode() {
				if (this.timeOut != 60) {
					return;
				}
				var _this = this;
				var timer = setInterval(function() {
					_this.codeBtnText = "倒计时(" + _this.timeOut + ")";
					_this.timeOut--;
					if (_this.timeOut == 0) {
						timer.close();
						_this.codeBtnText = "重新获取"
						this.codeDisabled = false;
					}
				}, 1000)
			},
			onSubmitClick() {
				uni.navigateBack()
			}
		}
	}
</script>

<style>
	page {
		background: #F4F4F4;
	}

	.editTelsetting {
		margin: 26rpx 32rpx;
		border-radius: 16rpx;
		background-color: #FFFFFF;
		padding: 0 32rpx;
	}

	.editTel-item {
		height: 88rpx;
		display: flex;
		align-items: center;
		border-bottom: 1px solid #E5E5E5;
	}

	.editTel-item:last-child {
		border: 0;
	}

	.editTel-item-label {
		font-size: 30rpx;
		color: #181818;
	}

	.editTel-item-text {
		padding-left: 10px;
	}

	.user-item-input {
		flex: 1;
	}

	.user-item-input input {
		font-size: 30rpx;
		color: #181818;
	}

	.code-btn {
		font-size: 22rpx;
		color: #FFFFFF;
		background-color: #ACACAC;
		padding: 6rpx 10rpx;
		border-radius: 4rpx;
	}

	.submit-btn {
		margin-top: 40rpx;
	}
</style>
